﻿<%@ Page Title="" Language="C#" MasterPageFile="~/cadastros/Site.Master" AutoEventWireup="true" CodeBehind="Servo.aspx.cs" Inherits="CongregacaoOs.WebForm.Cadastros.Servo" %>

<%@ Register Src="~/Cadastros/MessageWindow.ascx" TagPrefix="uc1" TagName="MessageWindow" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">


    <script type="text/javascript">

        $(document).ready(function () {
            var activeIndex = parseInt($('#<%=hfIndexAccordion.ClientID %>').val());
            $("#accordion").accordion({
                collapsible: true,
                autoHeight: false,
                navigation: true,
                active: activeIndex,
                change: function (event, ui) {
                    var index = $(this).children('h3').index(ui.newHeader);
                    $('#<%=hfIndexAccordion.ClientID %>').val(index);
                }
            });
        });

        $(function () {
            $("#tabs").tabs();
        });

        $(function () {
            $("#DivReset").tabs();
        });


    </script>
    <script src="../Scripts/Mascaras.js"></script>
    <link href="../Content/NewTheme/gridView.css" rel="stylesheet" />

    <style type="text/css">
        .auto-style3 {
            width: 87px;
        }

        .auto-style6 {
            width: 90px;
        }

        .auto-style9 {
            width: 65px;
        }

        .auto-style10 {
            width: 281px;
        }

        .auto-style11 {
            width: 103px;
            height: 24px;
        }

        .auto-style12 {
            height: 24px;
        }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:HiddenField ID="hfIndexAccordion" runat="server" />

    <div id="accordion">
        <h3><a href="#">Consultar</a></h3>
        <div>
            <asp:Panel ID="PainelConsulta" runat="server" Style="width: 70%; margin: 0 auto;">
                <asp:UpdatePanel runat="server" ID="pnlRefhresh">
                    <ContentTemplate>

                        <h2>Cadastro de Usuário</h2>
                        <hr />
                        <br />
                        <table style="width: 100%">
                            <tr>
                                <td>Usuário:<br />
                                    <asp:TextBox ID="txtBuscarNome" Width="100%" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>Regional:<br />
                                    <asp:DropDownList ID="dropRegionalFiltro" DataTextField="regional" DataValueField="idRegional" runat="server" AutoPostBack="True" Height="21px" Width="300px" Style="margin-left: 0px" OnDataBound="dropRegionalFiltro_DataBound" OnSelectedIndexChanged="dropRegionalFiltro_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>Distrital:<br />
                                    <asp:DropDownList ID="dropDistritalFiltro" DataTextField="distrital" DataValueField="idDistrital" runat="server" AutoPostBack="True" Height="22px" Width="300px" OnDataBound="dropDistritalFiltro_DataBound" OnSelectedIndexChanged="dropDistritalFiltro_SelectedIndexChanged"></asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>Administração:<br />
                                    <asp:DropDownList ID="dropAdmFiltro" DataTextField="adm" DataValueField="idAdm" runat="server" Height="22px" Width="300px" AutoPostBack="True" OnDataBound="dropAdmFiltro_DataBound" OnSelectedIndexChanged="dropAdmFiltro_SelectedIndexChanged"></asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>Setores:<br />
                                    <asp:DropDownList ID="dropSetorFiltro" DataTextField="nome" DataValueField="idSetor" runat="server" Height="22px" Width="300px" AutoPostBack="True" OnDataBound="dropSetorFiltro_DataBound" OnSelectedIndexChanged="dropSetorFiltro_SelectedIndexChanged"></asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>Status:<br />
                                    <asp:RadioButtonList Font-Size="Medium" AutoPostBack="true" ID="radioStatusUsu" runat="server" OnSelectedIndexChanged="radioStatusUsu_SelectedIndexChanged" RepeatDirection="Horizontal" CellSpacing="5">
                                        <asp:ListItem Value="0" Selected="True">Todos</asp:ListItem>
                                        <asp:ListItem Value="1">Ativos</asp:ListItem>
                                        <asp:ListItem Value="2">Inativos</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                            </tr>

                        </table>
                        <br />

                    </ContentTemplate>
                </asp:UpdatePanel>
                <table style="width:100%;">
                    <tr>
                        <td>

                            <hr />
                            <asp:GridView ID="gvServo" runat="server" Style="font-size: smaller; width: 100%; margin: 0 auto;"
                                AutoGenerateColumns="False"
                                GridLines="None"
                                AllowPaging="True"
                                CssClass="mGrid"
                                PagerStyle-CssClass="pgr"
                                AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="gvServo_PageIndexChanging" PageSize="7" AllowSorting="True" ShowFooter="True" ShowHeaderWhenEmpty="True" ToolTip="Usuários" OnRowCommand="gvServo_RowCommand" OnRowDataBound="gvServo_RowDataBound">
                                <AlternatingRowStyle CssClass="alt" />
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Edit.png" CommandName="EDITAR" CommandArgument="<%# Bind('idPessoa') %>" ToolTip="Editar" runat="server" Width="20px" ID="imgEditar" />
                                            &nbsp;&nbsp;&nbsp;
                                <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Delete.png" CommandName="EXCLUIR" runat="server" CommandArgument="<%# Bind('idPessoa') %>" ToolTip="Excluir" Width="20px" ID="imgDelete" />

                                            <asp:HiddenField ID="hdIdPessoa" runat="server" Value="<%# Bind('idPessoa') %>" />
                                            <asp:HiddenField ID="hdServo" runat="server" Value="<%# Bind('Servo') %>" />
                                            <asp:HiddenField ID="hdStatus" runat="server" Value="<%# Bind('status') %>" />
                                            <asp:HiddenField ID="hdFone" runat="server" Value="<%# Bind('fone') %>" />

                                            <asp:HiddenField ID="hdCelular" runat="server" Value="<%# Bind('celular') %>" />
                                            <asp:HiddenField ID="hdEmail" runat="server" Value="<%# Bind('email') %>" />
                                            <asp:HiddenField ID="hdRegional" runat="server" Value="<%# Bind('regional') %>" />
                                            <asp:HiddenField ID="hdDistrital" runat="server" Value="<%# Bind('Distrital') %>" />


                                            <asp:HiddenField ID="hdCidade" runat="server" Value="<%# Bind('cidade') %>" />
                                            <asp:HiddenField ID="hdComum" runat="server" Value="<%# Bind('comum') %>" />
                                            <asp:HiddenField ID="hdUserName" runat="server" Value="<%# Bind('userName') %>" />
                                            <asp:HiddenField ID="hdRoleName" runat="server" Value="<%# Bind('RoleName') %>" />

                                            <asp:HiddenField ID="hdCargo" runat="server" Value="<%# Bind('cargo') %>" />
                                            <asp:HiddenField ID="hdQuestion" runat="server" Value="<%# Bind('PasswordQuestion') %>" />
                                            <asp:HiddenField ID="hdSetor" runat="server" Value="<%# Bind('Setor') %>" />

                                            <asp:HiddenField ID="hdAdm" runat="server" Value="<%# Bind('Adm') %>" />

                                        </ItemTemplate>
                                        <ItemStyle Width="11%" HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="idPessoa" HeaderText="Código" ItemStyle-HorizontalAlign="Center" HtmlEncode="False">
                                        <ItemStyle Width="5%" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Servo" HeaderText="Usuário" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HtmlEncode="False">
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <ItemStyle Width="15%" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Regional" HeaderText="Regional" HeaderStyle-HorizontalAlign="Left" HtmlEncode="False">
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <ItemStyle Width="15%" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Cidade" HeaderText="Cidade" HeaderStyle-HorizontalAlign="Left" HtmlEncode="false">
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <ItemStyle Width="15%" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Comum" HeaderText="Comum" HeaderStyle-HorizontalAlign="Left" HtmlEncode="false">
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <ItemStyle Width="15%" />
                                    </asp:BoundField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton CommandArgument="<%# Bind('IsApproved') %>" ToolTip="" runat="server" Width="20px" ID="imgStatus" />
                                        </ItemTemplate>
                                        <ItemStyle Width="5%" HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>

                                </Columns>
                                <EmptyDataTemplate>
                                    Nenhum registro encontrado...
                                </EmptyDataTemplate>
                                <PagerStyle CssClass="pgr" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <table style="width: 70%; margin: 0 auto;">
                <tr>
                    <td></td>
                    <td>
                        <div style="float: right;">
                            <asp:Button ID="btnBuscar" Width="150px" Height="50px" runat="server" Text="Pesquisar" OnClick="btnBuscar_Click" />
                            <asp:Button ID="btnAdicionarNovo" Width="150px" Height="50px" runat="server" Text="Adicionar" OnClick="btnAdicionarNovo_Click" />
                        </div>
                    </td>
                </tr>
            </table>

        </div>

        <h3><a href="#">Cadastrar/Editar</a></h3>
        <div>
            <asp:Panel ID="painelCadastro" runat="server" Style="width: 70%; margin: 0 auto;">
                <asp:HiddenField ID="hdID" runat="server" />
                <asp:UpdatePanel runat="server" ID="pnlAtualizar">
                    <ContentTemplate>

                        <label>Nome Completo</label>
                        <asp:TextBox ID="txtNome" Width="100%" runat="server"></asp:TextBox><br />

                        <label>Email</label>
                        <asp:TextBox ID="txtEmail" Width="100%" runat="server"></asp:TextBox><br />

                        <label>Celular</label>
                        <asp:TextBox ID="txtCelular" Width="100%" runat="server" onkeyup="formataTelefone(event)"></asp:TextBox><br />

                        <label>Telefone</label>
                        <asp:TextBox ID="txtTelefone" Width="100%" onkeyup="formataTelefone(event)" runat="server"></asp:TextBox><br />
                        <br />
                        <label>Ativar Usuário?</label>
                        <asp:CheckBox runat="server" ID="checkAtivo" /><br />
                        <br />
                        <label>Regional</label><br />
                        <asp:DropDownList ID="dropRegional" runat="server" DataTextField="regional" DataValueField="idRegional" Height="25px" Width="285px" AutoPostBack="True" OnSelectedIndexChanged="dropRegional_SelectedIndexChanged" OnDataBound="dropRegional_DataBound"></asp:DropDownList>
                        <br />
                        <label>Distrital</label><br />
                        <asp:DropDownList ID="dropDistrital" runat="server" DataTextField="distrital" DataValueField="idDistrital" Height="25px" Width="285px" AutoPostBack="True" OnSelectedIndexChanged="dropDistrital_SelectedIndexChanged" OnDataBound="dropDistrital_DataBound"></asp:DropDownList>
                        <br />
                        <label>Administração</label><br />
                        <asp:DropDownList ID="dropAdministracao" runat="server" DataTextField="Adm" DataValueField="idAdm" Height="25px" Width="285px" AutoPostBack="True" OnSelectedIndexChanged="dropAdministracao_SelectedIndexChanged" OnDataBound="dropAdministracao_DataBound"></asp:DropDownList>
                        <br />
                        <label>Setor</label><br />
                        <asp:DropDownList ID="dropSetor" runat="server" DataTextField="nome" DataValueField="idSetor" Height="25px" Width="285px" AutoPostBack="True" OnSelectedIndexChanged="dropSetor_SelectedIndexChanged" OnDataBound="dropSetor_DataBound">
                        </asp:DropDownList>
                        <br />
                        <label>Cargo</label><br />
                        <asp:DropDownList ID="dropCargo" runat="server" DataTextField="cargo" DataValueField="idCargo" Height="25px" Width="285px" OnDataBound="dropCargo_DataBound">
                        </asp:DropDownList>
                        <br />
                        <label>Cidade em que  reside</label><br />
                        <asp:DropDownList ID="dropCidade" runat="server" DataTextField="cidade" DataValueField="idCidade" Height="25px" Width="285px" AutoPostBack="True" OnSelectedIndexChanged="dropCidade_SelectedIndexChanged" OnDataBound="dropCidade_DataBound"></asp:DropDownList>
                        <br />
                        <label>Comum</label><br />
                        <asp:DropDownList ID="dropComum" runat="server" DataTextField="Igreja" DataValueField="idIgreja" Height="25px" Width="285px" OnDataBound="dropComum_DataBound"></asp:DropDownList>
                    </ContentTemplate>
                </asp:UpdatePanel>

                <br />
                <br />
                <hr />
                <div id="tabs">
                    <ul>
                        <li><a href="#tabs-1">Cadastro Usuário</a></li>
                        <li><a href="#tabs-2">Alterar Senha</a></li>
                    </ul>
                    <div id="tabs-1">

                        <label>Usuário de Acesso</label>
                        <asp:TextBox ID="txtUsuario" Width="100%" runat="server"></asp:TextBox>

                        <label>Senha</label>
                        <asp:TextBox ID="txtSenha" Width="100%" TextMode="Password" runat="server"></asp:TextBox>

                        <label>Confirme a Senha</label>
                        <asp:TextBox ID="txtSenhaConfirm" Width="100%" TextMode="Password" runat="server"></asp:TextBox>

                        <label>Lembrete da senha</label>
                        <asp:TextBox ID="txtLembrete" Width="100%" runat="server"></asp:TextBox>

                        <label>Tipo Usuário</label>
                        <br />
                        <asp:DropDownList runat="server" ID="dropRoles" Height="25px" Width="285px"></asp:DropDownList>


                    </div>
                    <div id="tabs-2">
                        <label>Senha Antiga</label>
                        <asp:TextBox ID="txtOldPassword" Width="100%" TextMode="Password" runat="server"></asp:TextBox>

                        <label>Senha</label>
                        <asp:TextBox ID="txtPassword" Width="100%" TextMode="Password" runat="server"></asp:TextBox>

                        <br />
                        <br />
                        <asp:Button ID="btnTrocarSenha" Width="150px" Height="50px" runat="server" Text="Trocar Senha" OnClick="btnTrocarSenha_Click" />
                    </div>
                </div>


                <br />
                <asp:Button ID="btnSalvar" Width="150px" Height="50px" runat="server" Text="Salvar" OnClick="btnSalvar_Click" ValidationGroup="CADASTRO" />
                <asp:Button ID="btnVoltar" Width="150px" Height="50px" runat="server" Text="Voltar" OnClick="btnVoltar_Click" />

                <br />
                <br />
                <hr />
                <asp:Panel runat="server" ID="ResetPasswordPanel" Visible="false">
                    <div id="DivReset">
                        <ul>
                            <li><a href="#tabs-12">Resetar Senha</a></li>
                        </ul>
                        <div id="tabs-12">
                            <label>Usuário</label>
                            <asp:TextBox runat="server" Width="100%" ID="txtUserNameRetrieval"></asp:TextBox>
                            <label>Nova Senha</label>
                            <asp:TextBox runat="server" Width="100%" TextMode="Password" ID="txtNewPassword"></asp:TextBox><br />
                            <br />
                            <asp:Button ID="btnPasswordRetrieval" Width="150px" Height="50px" runat="server" Text="Reset" OnClick="btnPasswordRetrieval_Click" />
                        </div>
                    </div>
                </asp:Panel>
            </asp:Panel>


        </div>
    </div>

    <uc1:MessageWindow runat="server" ID="MessageWindow" />

</asp:Content>
